package cn.tedu.reciew.Test;

import java.io.*;

/*本类用于复习流对象的创建*/
public class CreateStream {
    public static void main(String[] args) {
        f1();//用于复习字节流
        f2();//用于复习字符流
    }
    //字符流对象的创建
    private static void f2() {
        //用于复习字符输入流
        //Reader in =new Reader(),----抽象不可以被实例化

        try {
            FileReader in = new FileReader("");
            FileReader in2 = new FileReader(new File(""));
            BufferedReader in3 = new BufferedReader(new FileReader(""));
            BufferedReader in4 = new BufferedReader(new FileReader(new File("")));
        } catch (Exception e) {
            e.printStackTrace();
        }finally{

        }



        //用于复习字符输出流
        // 字节流对象的创建
            Writer out = null;
            //out = new Writer();//抽象父级不可以实例化
        try {
            out =new FileWriter(new File(""));
            out  = new FileWriter("",true);
            out  = new FileWriter("");
            out  = new FileWriter(new File(""),true);
            out =new BufferedWriter(new FileWriter(""));
            out =new BufferedWriter(new FileWriter(new File("")));
            out =new BufferedWriter(new FileWriter(new File(""),true));
            out =new BufferedWriter(new FileWriter("",true));
        } catch (IOException e) {
            e.printStackTrace();
        }finally{
            try {
                out.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }


    }

    private static void f1() {
        //字节输入流
        //InputStream in= new InputStream();---抽象父级不可以被实例化
        FileInputStream in=null;
        try{
            in = new FileInputStream(new File(""));
            FileInputStream in2 = new FileInputStream("");
            BufferedInputStream in3 = new BufferedInputStream(new FileInputStream(""));
            BufferedInputStream in4 = new BufferedInputStream(new FileInputStream(new File("")));
        }catch(Exception e){
            e.printStackTrace();
        }finally{
            try {
                in.close();
            } catch (IOException e) {
                e.printStackTrace();
            }

        }
        //字节输出流
        //OutputStream out = new OutputStream();//抽象父级不可以实例化
        FileOutputStream out=null;
        BufferedOutputStream out1=null;
        try{
            out = new FileOutputStream("");
            out = new FileOutputStream(new File(""));
            out = new FileOutputStream(new File(""),true);
            out = new FileOutputStream("",true);


            out1 = new BufferedOutputStream(new FileOutputStream(new File("")));
            out1 = new BufferedOutputStream(new FileOutputStream(""));
            out1 = new BufferedOutputStream(new FileOutputStream("",true));
            out1 = new BufferedOutputStream(new FileOutputStream(new File(""),true));
        }catch(Exception e){
            e.printStackTrace();
        }finally{
            try {
                out.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}
